from PIL import Image
import os
if __name__ == "__main__":
    iphoneFiles = [("notification",20),("settings",29),("spotlight",40),("icon",60),("appstore",1024)]
    imagePath = "/Users/joker/Desktop/幸福优居.png"
    basedir = os.path.dirname(imagePath)
    newDir = f"{basedir}/aa"
    if os.path.isdir(newDir) == False:
        os.mkdir(newDir)
    for file in iphoneFiles:
        for x in range(1,4):
            retainString = ""
            if x > 1 :
                retainString = f"@{x}x"
            image = Image.open(imagePath)
            size = file[1]*x,file[1]*x
            image.thumbnail(size)
            image.save(f"{basedir}/aa/{file[0]}{retainString}.png")
    print("生成完毕")
